#include "thread.h"
#include <stdio.h>
#include <assert.h>

#define LOOP_COUNT 100000

long step;

static void *f(void * arg)
{
	step++;
	return (void*)step;
}

int main(int argc, char *argv[])
{
	thread_t t;
	long i;
	step = 0;
	for(i = 0; i < LOOP_COUNT; i++) {
		assert(!thread_create(&t, f, NULL));
		assert(!thread_join(t, NULL));
		assert(step == (i+1));
	}
	return 0;
}
